package com.blb.article_ms.entity.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.blb.article_ms.entity.Comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author xray
 * @since 2023-06-14
 */
@Data
@ApiModel("文章")
public class ArticleDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("编号")
    private Integer id;

    @NotNull(message = "标题不能为空")
    @ApiModelProperty("标题")
    private String title;

    @Pattern(message = "格式必须是jpg或png",regexp = "\\w+(.jpg|.png)")
    @ApiModelProperty("图片")
    private String pic;

    @NotNull(message = "内容不能为空")
    @Length(message = "内容长度不能少于10个字",min = 10)
    @ApiModelProperty("内容")
    private String content;

    @Past(message = "发表时间必须早于当前时间")
    @ApiModelProperty("时间")
    private LocalDateTime time;
}
